<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 2018/9/20
 * Time: 16:31
 */
?>

<div class="row">
    <div class="col-sm-12">
        <table class="table table-bordered table-hover">
            <thead>
            <tr>
                <th>发送到ICBC时间</th>
                <th>ICBC订单号</th>
                <th>被征信人</th>
                <th>身份证号</th>
                <?=Yii::$app->request->get('date_start')?"<th>网点</th>":'' ?>
                <th>订单中角色</th>
                <th>即时机器反馈</th>
                <th>人工反馈</th>
                <th>人工反馈时间</th>
                <th>是否正常</th>
                <th>退回原因</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach ($data as $k => $v): ?>
                <?php
                if ($v['退回原因']){
                    $x = $v['退回原因'];
                    $x = unserialize($x);
                    if (isset($x['reqparam']))$x = $x['reqparam'];
                    $x = json_decode($x, true);
                    if (isset($x['req']['note']))$x1 = $x['req']['note'];
                    if (isset($x['req']['result']))$x2 = $x['req']['result'];
                }else{
                    $x1 = '';
                    $x2 = '';
                }
                $orderno = (integer)substr($v['ICBC订单号'], -11);
                $is_tr_show = 1;
                if (Yii::$app->request->get('date_start')){
                    $_order = \common\models\credit_app\Order::findOne(['o_id' => $orderno]);
                    $is_tr_show = 0;
                    if ($v['13人工已反馈，11等待人工反馈']==13){
                        if ($x2=='001'){
                            $is_tr_show = 1;
                        }else{
                            $is_tr_show = 0;
                        }
                    }
                }
                ?>
            <?php if ($is_tr_show): ?>
                <tr>
                    <td><?=$v['发送到ICBC时间'] ?></td>
                    <td><?=$v['ICBC订单号'] ?></td>
                    <td><?=$v['被征信人'] ?></td>
                    <td><?=$v['身份证号'] ?></td>
                    <?=Yii::$app->request->get('date_start')?"<td>{$_order->o_branch}</td>":'' ?>
                    <td><?=$v['订单中角色'] ?></td>
                    <td><?=$v['即时机器反馈'] ?></td>
                    <td><?php
                        if ($v['13人工已反馈，11等待人工反馈']==11){
                            echo "等待人工反馈";
                        }
                        if ($v['13人工已反馈，11等待人工反馈'] == 13){
                            echo "人工已反馈";
                        }
                        ?></td>
                    <td><?=$v['人工反馈时间'] ?></td>
                    <td><?php
                        if ($v['13人工已反馈，11等待人工反馈']==13){
                            if ($x2=='001'){
                                echo "正常";
                            }else{
                                echo "异常";
                            }
                        }
                        ?></td>
                    <td><?php
                        if ($x2=='001'){}else{
                            echo $x1;
                        }
                        ?></td>
                </tr>
            <?php endif; ?>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
